﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<link href="${ctx.resource}/css/component/coverupload.css" rel="stylesheet">

<div class="modal-dialog x-modal-dialog" style="width:600px; margin-top: 150px;">

  <div class="modal-content">

    <div class="modal-header x-breadcrumb no-bottom-border clearfix">

      <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>打卡课程管理&nbsp;-&nbsp;新建课程</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>

    <form class="form-horizontal" method="POST" action="${ctx.host}/market-courses" data-validate="true">
      
      <div class="modal-body">
                
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">名称</label>
          <div class="pull-left col-xs-8">
            <input type="text" name="name" value="" class="form-control" placeholder="请输入名称" data-validate="required">
          </div>
        </div>
        
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">等级</label>
          <div class="pull-left col-xs-8">
            <select name="courseLevel" class="form-control" data-validate="required">
              <option value=""></option>
              <c:forEach var="level" items="${enums['courseLevel']}">
                <option value="${level}">${level.description}</option>
              </c:forEach>
            </select>
          </div>
        </div>
        
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">难度系数</label>
          <div class="pull-left col-xs-8">
            <input type="text" name="difficulty" value="" class="form-control" placeholder="请输入难度系数" data-validate="required|number">
          </div>
        </div>
        
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">描述</label>
          <div class="pull-left col-xs-8">
            <textarea name="description" class="form-control"  placeholder="请输入描述" rows="5" data-validate="required"></textarea>
          </div>
        </div>
        
        <div class="form-group x-form-group no-hover">
          <label class="col-xs-3 control-label" >封面</label>
          <div class="col-xs-8 pull-left upload-cover" style="width: 120px; height: 100px;">
            <button type="button" id="pickCover" class="edit-btn"><span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>&nbsp;&nbsp;选择文件</button>
            <div id="coverPreviewList">
              <img id="coverPreview" src=""/>
            </div>
            <label id="messageCover" class="control-label messageCover hide"></label>
          </div>
          <input type="hidden" id="cover" name="cover" value="" />
        </div>
        
      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default x-btn" data-dismiss="modal">取消</button>
      </div>
    </form>

  </div>
  
</div>

<script type="text/javascript">
  $('select[name="courseLevel"]').select2({
    placeholder : '请选择等级',
    minimumResultsForSearch : 5,
    allowClear : false,
  });
  
</script>